//
//  Student1.m
//  OC3_继承
//
//  Created by dllo on 15/10/26.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "Student1.h"

@implementation Student1

+ (id)studentWithName:(NSString *)name sex:(NSString *)sex age:(NSInteger)age score:(CGFloat)score
{

    Student1 *p = [[Student1 alloc] initWithName:name sex:sex age:age score:score];
    return p;

}

- (id)initWithName:(NSString *)name sex:(NSString *)sex age:(NSInteger)age score:(CGFloat)score
{

    self = [super initWithName:name sex:sex age:age];
    if (self) {
//        _score = score;
        [self setScore:score];
    }
    
    return self;

}


- (CGFloat)score
{
    return _score;
}

- (void)setScore:(CGFloat)score
{
    _score = score;
}

//- (id)initWithName:(NSString *)name sex:(NSString *)sex age:(NSInteger)age score:(CGFloat)score
//{
//    _name = name;
//    _sex = sex;
//    _age = age;
//    _score = score;
//    return self;
//}

- (void)info
{
//    NSLog(@"%@ %@ %ld %.2f", _name, _sex, _age, _score);
    
    // self优先去找自己重写的info, 若没有再去找继承来的父类的info
    // super直接去找继承来的父类的info
//    [self info];
    [super info];
    NSLog(@"%.1f", _score);
    
}



@end
